load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//bzl:cpp_unittest.bzl", "cpp_unittest")

# TODO(kgk): Fix test.
# cpp_unittest(
#     name = "fibers_test",
#     srcs = ["FibersTest.cpp"],
#     deps = [
#         "//folly:conv",
#         "//folly:memory",
#         "//folly:random",
#         "//folly/coro:blocking_wait",
#         "//folly/coro:gtest_helpers",
#         "//folly/coro:timeout",
#         "//folly/coro:with_cancellation",
#         "//folly/executors:cpu_thread_pool_executor",
#         "//folly/fibers:add_tasks",
#         "//folly/fibers:atomic_batch_dispatcher",
#         "//folly/fibers:batch_dispatcher",
#         "//folly/fibers:batch_semaphore",
#         "//folly/fibers:core_manager",
#         "//folly/fibers:event_base_loop_controller",
#         "//folly/fibers:executor_loop_controller",
#         "//folly/fibers:fiber_manager_map",
#         "//folly/fibers:generic_baton",
#         "//folly/fibers:semaphore",
#         "//folly/fibers:simple_loop_controller",
#         "//folly/fibers:timed_mutex",
#         "//folly/fibers:when_n",
#         "//folly/futures:core",
#         "//folly/io/async:scoped_event_base_thread",
#         "//folly/portability:gtest",
#         "//folly/tracing:async_stack",
#     ],
# )

cc_binary(
    name = "fibers_test_app",
    srcs = ["FibersTestApp.cpp"],
    deps = [
        "//folly:memory",
        "//folly/fibers:core_manager",
        "//folly/fibers:simple_loop_controller",
    ],
)

cc_binary(
    name = "stack_overflow",
    srcs = ["StackOverflow.cpp"],
    copts = ["-Wno-infinite-recursion"],
    deps = [
        "//folly/fibers:fiber_manager_map",
        "//folly/init",
    ],
)

cpp_unittest(
    name = "semaphore_test",
    srcs = ["SemaphoreTest.cpp"],
    deps = [
        "//folly/fibers:semaphore",
        "//folly/portability:gtest",
        "//folly/synchronization:relaxed_atomic",
        "//folly/synchronization/detail:sleeper",
    ],
)
